import Vue from 'vue';
import VueRouter from 'vue-router';
import Home from '@/pages/home';
import Homepage from '@/pages/homepage';
import Qa from '@/pages/qa';
import Video from '@/pages/video';
import My from '@/pages/my';
import Login from '@/pages/login';
import UserInfo from '@/pages/user-info';
import SearchPage from '@/pages/search-page';
import SearchRes from '@/pages/search-res';
import ArticlePage from '@/pages/article-page';
import CommentPage from '@/pages/comment-page';
Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    component: Home,
    redirect: '/homepage',
    children: [
      {
        // 首页
        path: '/homepage',
        component: Homepage,
      },
      {
        // 问答
        path: 'qa',
        component: Qa,
      },
      {
        // 视频
        path: 'video',
        component: Video,
      },
      {
        // 我的
        path: 'my',
        component: My,
      },

    ]
  },
  {
    // 登录
    path: '/login',
    component: Login,
  },
  {
    // 用户信息
    path: '/user-info',
    component: UserInfo,
  },
  {
    // 搜索
    path: '/search-page',
    component: SearchPage,
  },
  {
    // 搜索结果
    path: '/search-res',
    name: 'search-res',
    component: SearchRes,
  },
  {
    // 文章页面
    path: '/article-page',
    name: 'article-page',
    component: ArticlePage,
  },
  {
    // 评论页面
    path: '/comment-page',
    name: '/comment-page',
    component: CommentPage,
  },
];

export default new VueRouter({ routes });